package com.aws.remote;

import com.amazonaws.services.s3.AmazonS3;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.File;

/**
 * @description:
 * @author: libugu@cskaoyan.com
 * @date 2024/1/18 - 9:03
 */
@Component
public class RemoveLinuxDemo {

    String bucketName = "mylibugu";
    String localFolderPath = "C:\\Users\\libugu\\Desktop\\2027";
    String folderKeyword = "12";
    @Autowired
    AmazonS3 s3Client;
    public void test() {
        //
        String localFolderPath = "/home/testremove/2027";

        // 设置 S3 存储桶名称和前缀
        String bucketName = "mylibugu";
        String prefix = "202110";



        try {
            // 递归遍历本地文件夹并上传到 S3
            File folder = new File(localFolderPath);
            uploadFilesToS3(s3Client, folder, bucketName, prefix);
            // 关闭 S3 客户端
            s3Client.shutdown();
            System.out.println("迁移成功");
        } catch (Exception e) {
            System.out.println("迁移失败");
            throw new RuntimeException(e);
        }
    }

    private void uploadFilesToS3(AmazonS3 s3Client, File folder, String bucketName, String prefix) {




    }


}
